import type { PageQry } from "@/types/common";

export interface MachineDTO {
  id: string;
  groupId: string;
  groupName: string;
  name: string;
  ip: string;
  port: number;
  username: string;
  password?: string;
  type: MachineType;
  publicKey?: string;
  isJump: boolean;
  jumpMachineId?: string;
}

export class MachinePageQry implements PageQry {
  size: number = 10; // 默认值为 10
  current: number = 1; // 默认值为 1
  id?: string;
  groupId?: string;
  nameLike?: string;
  ipLike?: string;
  usernameLike?: string;
  idIn?: Array<string>;
}

export enum MachineType {
  Password = 1,
  PublicKey = 2
}

export class MachineSaveCmd {
  id?: string;
  groupId: string = "";
  name: string = "";
  ip: string = "";
  port: number = 22;
  username: string = "root";
  password?: string;
  type: MachineType = MachineType.Password;
  publicKey?: string;
  isJump: boolean = false;
  jumpMachineId?: string;
}

export class MachineBatchDeleteCmd {
  ids: string[];

  constructor(ids: string[]) {
    this.ids = ids;
  }
}
